from rest_framework import viewsets
# from rest_framework.filters import SearchFilter
from cabinet.serializers import CabinetSerializer
from cabinet.models import Cabinet
from cabinet.filter import CabinetFilter


# Create your views here.
class CabinetViewset(viewsets.ModelViewSet):
    """
    list: 返回机柜列表
    retrieve: 返回单个机柜信息
    update: 更新机柜信息
    destroy: 删除机柜记录
    create: 创建机柜记录
    partial_update: 更新记录的部分字段
    """
    serializer_class = CabinetSerializer
    queryset = Cabinet.objects.all()
    filter_class = CabinetFilter
    filter_fields = ('name', 'idc')
